/*
** atoi.c for atoi in /home/deubel_j//colle
** 
** Made by james deubelbeiss
** Login   <deubel_j@epitech.net>
** 
** Started on  Mon Apr 18 19:45:01 2011 james deubelbeiss
** Last update Mon Apr 18 19:45:41 2011 james deubelbeiss
*/

int     is_num(char c)
{
  return ((c >= 48) && (c <= 57));
}

unsigned int    my_atoui(char *num)
{
  unsigned int  retval;
  int   i;

  i = 0;
  retval = 0;
  while (num[i] && is_num(num[i]) && (i < 10))
    {
      if ((i < 9) || ((retval <= 429496729) && (num[i] <= 53)))
        retval = retval * 10 + (num[i] - 48);
      i++;
    }
  return (retval);
}
